<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>短视频设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<style>
.chblock{ }
.chblock li{ display: flex; margin-right: 10px; padding-top:3px ; float: left;}
.w200{ width:80px; margin:4px 10px 0 0 ; height: 31px; }
</style>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header"><i class="fa fa-cog"></i> 短视频设置</div>
				<div class="layui-card-body" pad15>
					<div class="layui-form form-label-w8" lay-filter="">
						
						<div class="layui-form-item">
							<label class="layui-form-label">视频列表样式：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[list_type]" value="0" {if $info['list_type']==0}checked{/if} title="样式一" />
								<input type="radio" name="info[list_type]" value="1" {if $info['list_type']==1}checked{/if} title="样式二"/>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">多商户视频：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[show_business_video]" value="1" {if $info['show_business_video']==1}checked{/if} title="显示" lay-filter="can_upload"/>
								<input type="radio" name="info[show_business_video]" value="0" {if $info['show_business_video']==0}checked{/if} title="不显示" lay-filter="can_upload"/>
							</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">平台视频链接，是否显示多商户视频</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">用户可否上传：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[can_upload]" value="1" {if $info['can_upload']==1}checked{/if} title="是" lay-filter="can_upload"/>
								<input type="radio" name="info[can_upload]" value="0" {if $info['can_upload']==0}checked{/if} title="否" lay-filter="can_upload"/>
							</div>
						</div>
						<div id="can_uploadset" {if $info['can_upload']==0}style="display:none"{/if}>
							<div class="layui-form-item">
								<label class="layui-form-label">上传审核：</label>
								<div class="layui-input-inline">
									<input type="radio" name="info[upload_check]" value="1" {if $info['upload_check']==1}checked{/if} title="开启"/>
									<input type="radio" name="info[upload_check]" value="0" {if $info['upload_check']==0}checked{/if} title="关闭"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">上传最大限制：</label>
								<div class="layui-input-inline">
									<input type="text" name="info[upload_maxsize]" class="layui-input" value="{$info.upload_maxsize}">
								</div>
								<div class="layui-form-mid">kb</div>
								<div class="layui-form-mid layui-word-aux">0表示不限制</div>
							</div>
							<!-- <div class="layui-form-item">
								<label class="layui-form-label">上传最大时长：</label>
								<div class="layui-input-inline">
									<input type="text" name="info[upload_maxduration]" class="layui-input" value="{$info.upload_maxduration}">
								</div>
								<div class="layui-form-mid">秒</div>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">0表示不限制</div>
							</div> -->
						</div>
						{if getcustom('shortvideo_play_give')}
							<div class="layui-form-item">
								<label class="layui-form-label">观看赠送{:t('积分')}：</label>
								<div class="layui-input-inline" >
									<input type="number" class="layui-input" value="{$info.read_give_score}" name="info[read_give_score]">
								</div>
								<div class="layui-form-mid">{:t('积分')}</div>
								<div class="layui-form-mid layui-word-aux">观看完视频赠送</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">观看赠送{:t('余额')}：</label>
								<div class="layui-input-inline" >
									<input type="number" class="layui-input" value="{$info.read_give_money}" name="info[read_give_money]">
								</div>
								<div class="layui-form-mid">{:t('余额')}</div>
								<div class="layui-form-mid layui-word-aux">观看完视频赠送</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">观看赠送{:t('优惠券')}：</label>
								<div class="layui-input-inline" style="width:auto; overflow: hidden;">
									<table class="layui-table choose-coupon" style="width:500px" id="choose-coupon">
										<thead>
										<tr>
											<th>ID</th>
											<th>名称</th>
											<th>库存</th>
											<th>发放数量</th>
											<th>操作</th>
										</tr>
										</thead>
										{if $couponList}
										{foreach $couponList as $k=>$ff}
										<tr class="choose-tr-list">
											<td>{$ff.id}</td>
											<td>{$ff.name}</td>
											<td>{$ff.stock}</td>
											<td>
												<input type="hidden" name="info[coupon_list][coupon_id][]" value="{$ff.id}">
												<input type="number" name="info[coupon_list][coupon_num][]" class="layui-input" value="{$ff.coupon_num}">
											</td>
											<td>
												<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTr(this,{$ff.id})">删除</button>
											</td>
										</tr>
										{/foreach}
										{/if}
										<tr class="choose-tr-add">
											<td colspan="5"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseCoupon()">添加</button></td>
										</tr>
									</table>
									<div class="layui-form-mid layui-word-aux">请确认{:t('优惠券')}的有效期、库存有效</div>
								</div>
								<script>
									var chooseCouponLayer;
									function showChooseCoupon(){
										chooseCouponLayer = layer.open({type:2,title:'选择{:t(\'优惠券\')}',content:"{:url('Coupon/choosecoupon')}",area:['1000px','600px'],shadeClose:true});
									}
									function choosecoupon(res){
										var detail = res;
										var chooseClassName = '.choose-coupon';
										layer.close(chooseCouponLayer);
										var isadd = 0;
										$(chooseClassName).find('.choose-tr-list').each(function(){
											var thisfid = $(this).find('td:eq(0)').html();
											if(thisfid == detail.id){
												isadd = 1
												dialog('该项已添加过了');
											}
										})
										if(isadd == 0){
											var tr = '<tr class="choose-tr-list">' +
												'<td>'+detail.id+'</td>' +
												'<td>'+detail.name+'</td>' +
												'<td>'+detail.stock+'</td>' +
												'<td>' +
												'<input type="hidden" name="info[coupon_list][coupon_id][]" value="'+ detail.id+'"/>' +
												'<input type="number" name="info[coupon_list][coupon_num][]" value="1" class="layui-input"/>' +
												'</td>' +
												'<td>' +
												'<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTr(this,'+detail.id+')">删除</button>' +
												'</td>' +
												'</tr>';
											$(chooseClassName).find('.choose-tr-add').before(tr);
										}
									}
									function delChooseTr(obj,fid){
										$(obj).closest('.choose-tr-list').remove();
									}
								</script>
							</div>
						<div class="layui-form-item">
							<label class="layui-form-label">上传赠送{:t('积分')}：</label>
							<div class="layui-input-inline" >
								<input type="number" class="layui-input" value="{$info.add_give_score}" name="info[add_give_score]">
							</div>
							<div class="layui-form-mid">{:t('积分')}</div>
							<div class="layui-form-mid layui-word-aux">上传视频且审核通过赠送</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">每日每条最多赠送：</label>
							<div class="layui-input-inline">
								<input type="number" class="layui-input" value="{$info.mid_give_score}" name="info[mid_give_score]">
							</div>
							<div class="layui-form-mid">{:t('积分')}</div>
							<div class="layui-form-mid layui-word-aux">每个用户每日每条视频最多获得多少{:t('积分')}</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">每日最多赠送：</label>
							<div class="layui-input-inline">
								<input type="number" class="layui-input" value="{$info.day_give_score}" name="info[day_give_score]">
							</div>
							<div class="layui-form-mid">{:t('积分')}</div>
							<div class="layui-form-mid layui-word-aux">每个用户每天最多获得多少{:t('积分')}</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">每日每条最多赠送：</label>
							<div class="layui-input-inline">
								<input type="number" class="layui-input" value="{$info.mid_give_money}" name="info[mid_give_money]">
							</div>
							<div class="layui-form-mid">{:t('余额')}</div>
							<div class="layui-form-mid layui-word-aux">每个用户每日每条视频最多获得多少{:t('余额')}</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">每日最多赠送：</label>
							<div class="layui-input-inline">
								<input type="number" class="layui-input" value="{$info.day_give_money}" name="info[day_give_money]">
							</div>
							<div class="layui-form-mid">{:t('余额')}</div>
							<div class="layui-form-mid layui-word-aux">每个用户每天最多获得多少{:t('余额')}</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">每日每条最多赠送：</label>
							<div class="layui-input-inline">
								<input type="number" class="layui-input" step="1" min="0" value="{$info.mid_give_coupon}" name="info[mid_give_coupon]">
							</div>
							<div class="layui-form-mid">次</div>
							<div class="layui-form-mid layui-word-aux">每个用户每日每条视频最多可赠送{:t('优惠券')}次数</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">每日最多赠送：</label>
							<div class="layui-input-inline">
								<input type="number" class="layui-input" value="{$info.day_give_coupon}" name="info[day_give_coupon]">
							</div>
							<div class="layui-form-mid">次</div>
							<div class="layui-form-mid layui-word-aux">每个用户每天最多可赠送{:t('优惠券')}次数</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">控制进度手势：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[video_gesture]" value="1" {if $info['video_gesture']==1}checked{/if} title="开启"/>
								<input type="radio" name="info[video_gesture]" value="0" {if $info['video_gesture']==0}checked{/if} title="关闭"/>
							</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">开启后可按住拖动进度，如开启赠送请选择关闭</div>
						</div>
						{/if}
						{if getcustom('yx_shortvideo_jindubag')}
							<div class="layui-form-item">
								<label class="layui-form-label">底部分享：</label>
								<div class="layui-input-inline">
									<input type="radio" name="info[showshare]" value="1" {if $info['showshare']==1}checked{/if} title="开启"/>
									<input type="radio" name="info[showshare]" value="0" {if $info['showshare']==0}checked{/if} title="关闭"/>
								</div>
								<div class="layui-form-mid">显示：分享者头像/名称、分享按钮、立即领取按钮/价格，多商户店铺门店信息可点击导航</div>
							</div>
						{/if}
						<div class="layui-form-item">
							<label class="layui-form-label"></label>
							<div class="layui-input-block">
								<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
    </div>
  </div>
	{include file="public/js"/}
	<script>
	layui.form.on('radio(can_upload)', function(data){
		if(data.value == '1'){
			$('#can_uploadset').show();
		}else{
			$('#can_uploadset').hide();
		}
	})
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		//console.log(field)
		$.post("{:url('save')}",field,function(data){
			dialog(data.msg,data.status,data.url);
		})
	})
  </script>
	{include file="public/copyright"/}
</body>
</html>